package map.oj;

import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

/**
 * 坏键盘问题
 */
public class BadKeyBoard {
    public static void main(String[] args) {
        //自定义输入输出
        Scanner scanner = new Scanner(System.in);
        //期待输入
        String expectedStr = null;
        //实际输入
        String actualStr = null;
        //获取字符串
        while(scanner.hasNext()){
            expectedStr = scanner.next();
            actualStr = scanner.next();
        }
        //将输入的字符都统一为大写
        expectedStr = expectedStr.toUpperCase();
        actualStr = actualStr.toUpperCase();
        //定义set存储实际输入的字符集合
        Set<Character> actualSet = new HashSet<>();
        for (int i = 0; i < actualStr.length(); i++) {
            actualSet.add(actualStr.charAt(i));
        }
        //用于过滤重复元素的
        Set<Character> ret = new HashSet<>();
        //通过期望输入的顺序来迭代
        for (int i = 0; i < expectedStr.length(); i++) {
            char c = expectedStr.charAt(i);
            if(!actualSet.contains(c)){
                //说明实际输入没有c
                if (ret.add(c)){
                    //保证不重复打印
                    System.out.print(c);
                }
            }
        }
        System.out.println();
    }
}


